﻿using OccurrencesCore.Model;
using OccurrencesCore.Service;
using OccurrencesWorkflow.BaseControl.Base;
using OccurrencesWorkflow.BaseControl.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Transactions;

namespace OccurrencesWorkflow.SpecializedControl.ScheduledReturn.Tasks
{
    public class ScheduledClientCollectTaskControl : BaseTask
    {        
        public ScheduledClientCollectTaskControl(int taskId)
            : base(taskId)
        {

        }

        public void Complete(DateTime date)
        {
            using (TransactionScope scope = new TransactionScope())
            {                
                //update occurence setting the date and etc
                string aditionalMessage = string.Format("A data de agendamento com o cliente foi setada para {0}.", date.ToString("dd/MM/yyyy hh:mm:ss"));
                base.Complete(aditionalMessage);
                scope.Complete();
            }
        }
    }
}
